var component;
var sprite;

function createComponent(str,parent) {
    component = Qt.createComponent(str)
    if(component.status === Component.Ready)
        finishCreation(parent);
    else
        component.statusChanged.connect(finishCreation);
}

function finishCreation(parent){
    if(component.status === Component.Ready){
        sprite = component.createObject(parent)
        if(sprite === null){
            console.log("Error creating object");
        }
    }else if(component.status === Component.Error){
        console.log("Error loading component:",component.errorString());
    }
}
